package icst.cyber.hrm.mapper;

import java.sql.Connection;
import org.apache.log4j.Logger;

/**
 * @author NGOCLAN
 * 
 */
public class MapperDB {

	private Connection conn;

	protected Logger log = Logger.getLogger(MapperDB.class);

	/**
	 * The constructor.
	 * 
	 * @throws Exception
	 */
	public MapperDB() throws Exception {
		try {
			conn = icst.cyber.hrm.communicationDB.Connection.getConnection();
		} catch (Exception e) {
			log.error("MapperDB" + e);
		}
	}

	/**
	 * The constructor.
	 * 
	 * @param conn
	 */
	public MapperDB(Connection conn) {
		this.conn = conn;
	}

	/**
	 * Close the connection
	 * 
	 * @throws Exception
	 */
	public void closeConnection() throws Exception {
		try {
			getConnection().close();
		} catch (Exception e) {
			log.error("closeConnection" + e);
		}
	}

	/**
	 * @return conn
	 */
	public Connection getConnection() {
		return this.conn;
	}

	/**
	 * @param conn
	 */
	public void setConnection(Connection conn) {
		this.conn = conn;
	}

}
